//
//  IManager+ModuleActivityDetail.m
//  RocketProject
//
//  Created by Wu Chengwei on 13-9-28.
//  Copyright (c) 2013年 Rocket. All rights reserved.
//

#import "IManager+ModuleActivityDetail.h"
#import "NetUrlDefines.h"
#import "RequestUtlity.h"
#import "FrameworkRelativeDefines.h"
#import "RCActivityDetailDataModel.h"
#import "GloableEngineService.h"

@implementation IManager(ModuleActivityDetail)

-(int64_t)requestActivityDetail:(NSString *)activityID  withDelegate:(id<IManagerDelegate>)delegate{
    
    
    if (nil == activityID) {
        return kInvalidRequestId;
    }
    // 异步获取数据
    
    NSString *bduss = @"";
    if ([GloableEngineService sharedInstance].bduss) {
        bduss = [GloableEngineService sharedInstance].bduss;
    }
    CLLocationCoordinate2D coor = [[GloableEngineService sharedInstance] userLocation];
    
    NSString *urlSuffix = [NSString stringWithFormat:kRCActivityDetailPrefix,activityID,coor.latitude,coor.longitude,bduss];
    
    NSString *url = [RequestUtlity getFormattedUrl:urlSuffix];
    
    KFLog(@"request url %@",url);
    return [[IDataProvider sharedInstance] asyncFetchDataWithUserInfo:url
                                                             userInfo:nil
                                                      withCachePolicy:IDataCachePolicyLocalFileAndNetwork
                                                   withDataParseClass:[RCActivityDetailDataModel class]
                                                     withDataDelegate:delegate];
    
}

@end
